package com.czx.service;

import com.czx.mapper.QueryMapper;
import com.czx.pojo.Query;
import com.czx.tools.Pages;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @package: com.czx.service
 * @ClassName: QueryServiceimpl
 * @author: CZX.
 * @date: 2022/1/19 19:30
 */
@Service
public class QueryServiceimpl implements QueryService{
    @Resource
    private QueryMapper queryMapper;
    @Override
    public Pages getQuer(Integer user_id, int currentPageNo, int pageSize) {
        Pages pages=new Pages();
        PageHelper.startPage(currentPageNo,pageSize);
        List<Query> page=queryMapper.getQuer(user_id);
        System.err.println(page.size());
        pages.setTotalCount(queryMapper.count(user_id));
        pages.setPageSize(pageSize);
        pages.setCurrPageNo(currentPageNo);
        pages.setAccessControlDeviceList(page);
        return pages;
    }
}
